import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/auth/login',
    method: 'post',
    data
  })
}

export function getInfo() {
  return request({
    url: '/my/info',
    method: 'get'
  })
}

export function logout() {
  return request({
    url: '/auth/logout',
    method: 'post'
  })
}

export function fetchUserList(query) {
  return request({
    url: '/user/list',
    method: 'get',
    params: query
  })
}

export function createUser(data) {
  return request({
    url: '/user',
    method: 'post',
    data: data
  })
}

export function updateUser(data) {
  return request({
    url: '/user',
    method: 'put',
    data: data
  })
}

export function updateUserPassword(data) {
  return request({
    url: '/user/password',
    method: 'put',
    data: data
  })
}
